package com.chpro.common;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 各类操作
 * @author Administrator
 *
 */
public class Lang {
    /**
     * List<LinkedHashMap<String, Object>>  转换为 List<List<String>>
     * @param list
     * @param headers
     * @return
     */
    public static List<List<String>> getListUtil(List<Map<String, Object>> list,String[] headers){
        List<List<String>> resultList = new ArrayList<List<String>>();
        for(Map<String, Object> linkMap:list){
            List temp = new ArrayList();
            for(int i=0;i<headers.length;i++){

                temp.add(linkMap.get(headers[i]));
            }
            resultList.add(temp);
        }

        return resultList;
    }

    /**
     * Object 数组 转换 String 数组
     * @param objs
     * @return
     */
    public static String[] getStringArray(Object[] objs){
        String[] str = new String[objs.length];
        for(int i=0;i<objs.length;i++){
            str[i] = objs[i].toString();
        }
        return str;
    }
}